﻿@model IEnumerable<PlanificadorDeEventos.Models.Evento>

@{
    ViewBag.Title = "Mis Eventos";
}

<h2>Mis Eventos</h2>

<p>
    @Html.ActionLink("Nuevo", "Create")
</p>

 @using (Html.BeginForm("FiltrarMisEventos", "Evento", FormMethod.Post, null))
 {
  
    <input type="text" name="name" value="@ViewBag.Name" />
    <input type="submit" value="Buscar"/>

    <table class="bordered">
        <tr>
            <th style="padding-right:15px">
                @Html.DisplayNameFor(model => model.Nombre)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Description)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Date)
            </th>
            <th style="padding-left:15px">
                @Html.DisplayNameFor(model => model.EndRegistrationDate)
            </th>
            <th style="padding-left:15px">
                @Html.DisplayName("Acción")
            </th>
        </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Nombre)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Description)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Date)
            </td>
            <td style="padding-left:15px">
                @Html.DisplayFor(modelItem => item.EndRegistrationDate)
            </td>
           <td>
                @Html.ActionLink("Editar", "Edit", new { id = item.ID }) |
                @Html.ActionLink("Detalles", "Details", new { id = item.ID }) |
                @Html.ActionLink("Borrar",null, new { id = item.ID }, new { onclick = "ShowModelPopUp("+item.ID+")" })
           </td>
        </tr>
    }

    </table>
 }

<script type="text/javascript">
    ShowModelPopUp = function (id) {
        window.showModalDialog('/Evento/Delete/' + id, "WindowPopup", 'dialogWidth:400px; dialogHeight:200px; resizable:0; center:1;');
    }
</script>

 <div style="padding-top:20px">
 @Html.ActionLink("Volver", "Index", null, new { @class = "roundedButton" })
 </div>